#ifndef THREAD_CACHE
#define THREAD_CACHE

#include "Common.h"
#include "CentralCache.h"

class ThreadCache
{
  friend class ConCurrent;

public:
  void *alloc(size_t size);
  void dealloc(void *obj, size_t size);

  void *fetchCacheFromCentral(size_t index, size_t size);
  void listTooLong(FreeList &freeList, size_t size);

private:
  FreeList _freeLists[NFREE_LIST];
};

static thread_local ThreadCache *pTLSThreadCache = nullptr;

#endif
